package com.yuanfeng.order.controller;

import com.yuanfeng.commoms.util.ResponseResult;
import com.yuanfeng.commoms.vo.job.AcquiescenceVO;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @ClassName OrderGoodsController
 * @Description 订单商品
 * @Author hyq
 * @Date 2023/6/21 10:37
 * @Version 1.0
 **/
@RestController
@RequestMapping("order/goods")
public class OrderGoodsController extends BaseController{

    /**
     * 查询物流信息
     *
     * @param map
     * @return
     */
    @PostMapping("/queryLogistics")
    public ResponseResult queryLogistics(@RequestBody Map<Object, Object> map) {
        ResponseResult result = orderGoodsService.queryLogistics(map);
        return result;
    }


    /**
     * @Description: 退款查询商品信息
     * @Param:  [map]
     * @Return: com.yf.ShoppingCart.web.entity.ResultResp
     */
    @PostMapping("/order/goods")
    public ResponseResult queryReturnGoods(@RequestBody Map<String, Object> map){
        ResponseResult result = orderGoodsService.queryReturnGoods(map);
        return result;
    }

    /**
     * @Description: 查询商品信息带分页
     * @Param:  [map]
     * @Return: ResponseResult
     */
    @PostMapping("/selectByPage")
    public ResponseResult selectByPage(@RequestBody Map<String, Object> map){
        ResponseResult result = orderGoodsService.selectByPage(map);
        return result;
    }

    /**
     * 商品销售排行
     *
     * @param map
     * @return
     */
    @PostMapping("/query/salesRanking")
    public ResponseResult querySalesRanking(@RequestBody Map<String, Object> map) {
        ResponseResult result = orderGoodsService.querySalesRanking(map);
        return result;
    }

    /**
     * 定时任务-根据订单id商品信息
     *
     * @param orderId
     * @return
     */
    @GetMapping("/job/queryGoodsInfoById")
    public List<AcquiescenceVO> queryGoodsInfoByjob(@RequestParam("orderId") String orderId) {
        List<AcquiescenceVO> voList = orderGoodsService.queryGoodsInfoByjob(orderId);
        return voList;
    }

}
